#!/usr/bin/python3
# encoding=utf-8

from GPIO import GPIO


class Wheel(object):
    def __init__(self, p_idx, n_idx):
        self.p = GPIO(p_idx, init_with_output=True, init_with_high=True)
        self.n = GPIO(n_idx, init_with_output=True, init_with_high=True)
        self.speed = 0

    def set_speed(self, speed):
        self.speed = speed

    def stop(self):
        self.p.high()
        self.n.high()

    def forward(self, speed):  # 正向
        self.p.high()
        self.n.low()

    def reverse(self, speed):
        self.p.low()
        self.n.high()
